<?php

/**
 * AcctYear form base class.
 *
 * @method AcctYear getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAcctYearForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'acct_year'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctOpenning'), 'add_empty' => false)),
      'is_closed'   => new sfWidgetFormInputText(),
      'opr'         => new sfWidgetFormInputText(),
      'acct_set_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSet'), 'add_empty' => false)),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'acct_year'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctOpenning'))),
      'is_closed'   => new sfValidatorInteger(array('required' => false)),
      'opr'         => new sfValidatorString(array('max_length' => 45)),
      'acct_set_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSet'))),
      'created_at'  => new sfValidatorDateTime(),
      'updated_at'  => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('acct_year[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AcctYear';
  }

}
